﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<Microhard.WarehouseInsp.Buz.Models.SupProjectModel>" %>

<%@ Import Namespace="Microhard.Framework.MVCHelper" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    添加项目
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%using (Html.BeginForm("TempSaveCreate", "SupProject", FormMethod.Post))
      {
    %>
    <div class="section-header">
        <div class="title">
            <img src="<%=Url.Content("~/Content/images/ico-catalog.png")%>" alt="" />
            添加项目
        </div>
        <div class="options">
            <input type="submit" class="t-button" value="填写" name="save" />
            <%if (Model.OperationStatus == Microhard.Core.DBUtility.OperationStatus.TempSaveFinished)
              { %>
            <input type="button" class="t-button" value="发起审批流程" id="btnStartWF" />
            <%} %>
            <%=Html.ActionLink("返回", "Index", "SupProject", null, new { @class = "t-button" })%>
        </div>
    </div>
    <%Html.RenderPartial("CreateEdit", Model); %>
    <%} %>
    <%if (Model.OperationStatus == Microhard.Core.DBUtility.OperationStatus.TempSaveFinished)
      { %>
    <%Html.RenderPartial("PopUp", new Microhard.WebUI.Models.AttributeOfWindow()
  {
      Name = "winOfSelectApprover",
      Title = "审批人选择",
      AfterSelectedFunc = "AfterApproverSelected",
      IsMulitiplySelect = false,
      LoadContentFrom_Action = "SelectUser",
      LoadContentFrom_Controller = "JHBaseData",
      Area = "WarehouseInsp"
  });%>
    <script type="text/javascript">
        function AfterApproverSelected(e) {
            var userID = e[0].ID;
            var userName = e[0].Name;
            //提交到流程页面
            var baseLink = '<%=Url.Action("StartC6Workflow", "SupProject", new { identity = Model.ProjectID })%>';
            baseLink = baseLink + "&approvers=" + userID;
            window.location.href = baseLink;
        }

        $(document).ready(function () {
            $("#btnStartWF").click(function () {
                var userWin = $('#winOfSelectApprover').data('tWindow');
                userWin.center();
                userWin.open();
            });
        });
    </script>
    <%} %>
</asp:Content>
